var section_index = 0;	

var saisie_section = "<label>Section: </label><input id=\"section_!CODE_id\" class=\"short\" type=\"text\"/> <img onclick=\"ajoutLigneSaisie('section')\" src=\"images/add.gif\" alt=\"+\"/><br/>";

function nouvelle_section()
{
	section_index++;

	var elem = document.getElementById("sectionSpan");
	var newDiv = document.createElement("span");
	var ligneHtml = saisie_section;

	if ( section_index < 10 )
		ligneHtml = ligneHtml.replace(/!CODE/g, "0" + section_index);
	if ( 9 < section_index < 100 )
		ligneHtml = ligneHtml.replace(/!CODE/g, "" + section_index);

	if (section_index == 1) {
		var elem2 = document.getElementById("section_start");
		elem.removeChild(elem2);
		newDiv.innerHTML = ligneHtml; 
		elem.appendChild(newDiv);
	} else {
		newDiv.innerHTML = ligneHtml; elem.appendChild(newDiv);
	}
}

function extrait_section_json()
{
	var tableau_sections = new Array();	
	var elem_section;
	
	var section_prefix = "section_";
	var section_suffix = "_id"

	for (i = 0; i < section_index; i++) {
		var ligne_prelev_spec = new Array(2);
		if (i < 10) {
			elem_section = section_prefix + "0" + (i + 1) + section_suffix;
		} else if (9 < i && i < 100) {
			elem_section = section_prefix + (i + 1) + section_suffix;
		}
		tableau_sections[i] = document.getElementById(elem_section).value;
	}
	
	
	return tableau_sections;
}
